<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="业务类型" prop="businesstype">
        <el-select v-model="queryParams.businesstype" placeholder="请选择业务类型" clearable>
          <el-option label="请选择字典生成" value=""/>
        </el-select>
      </el-form-item>
      <el-form-item label="创建时间">
        <el-date-picker
          v-model="daterangeCreatetime"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="交付时间">
        <el-date-picker
          v-model="daterangeAlldeliveredtime"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="修改时间" prop="modifytime">
        <el-date-picker clearable
                        v-model="queryParams.modifytime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择修改时间"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="支付时间">
        <el-date-picker
          v-model="daterangePaytime"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="交易状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择交易状态" clearable>
          <el-option label="请选择字典生成" value=""/>
        </el-select>
      </el-form-item>
      <el-form-item label="交易类型" prop="tradetype">
        <el-select v-model="queryParams.tradetype" placeholder="请选择交易类型" clearable>
          <el-option label="请选择字典生成" value=""/>
        </el-select>
      </el-form-item>
      <!--      <el-form-item label="消费品支付" prop="sumproductpayment">
              <el-input
                v-model="queryParams.sumproductpayment"
                placeholder="请输入消费品支付"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>-->
      <el-form-item label="手机号" prop="mobile">
        <el-input
          v-model="queryParams.mobile"
          placeholder="请输入手机号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="渠道类型" prop="channelType">
        <el-select v-model="queryParams.channelType" placeholder="请选择渠道类型" clearable>
          <el-option label="请选择字典生成" value=""/>
        </el-select>
      </el-form-item>
      <el-form-item label="店名" prop="storeName">
        <el-input
          v-model="queryParams.storeName"
          placeholder="请输入店名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <!--     <el-col :span="1.5">
             <el-button
               type="primary"
               plain
               icon="el-icon-plus"
               size="mini"
               @click="handleAdd"
               v-hasPermi="['ali:trade:add']"
             >新增</el-button>
           </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['ali:trade:edit']"
        >修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['ali:trade:export']"
        >导出
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleDownload"
        >下载
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="tradeList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="交易ID" align="center" prop="id"/>
      <el-table-column label="业务类型" align="center" prop="businesstype"/>
      <!-- <el-table-column label="创建时间" align="center" prop="createtime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createtime, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>-->
      <el-table-column label="交付时间" align="center" prop="alldeliveredtime" width="180">
      </el-table-column>
      <el-table-column label="修改时间" align="center" prop="modifytime" width="180">
      </el-table-column>
      <el-table-column label="支付时间" align="center" prop="paytime" width="180">
      </el-table-column>
      <el-table-column label="交易状态" align="center" prop="status"/>
      <el-table-column label="交易总金额" align="center" prop="totalamount"/>
      <el-table-column label="交易类型" align="center" prop="tradetype"/>
      <el-table-column label="消费品支付" align="center" prop="sumproductpayment"/>
      <el-table-column label="收货地址" align="center" prop="address"/>
      <el-table-column label="手机号" align="center" prop="mobile"/>
      <el-table-column label="渠道类型" align="center" prop="channelType"/>
      <el-table-column label="店名" align="center" prop="storeName"/>
      <el-table-column label="运费" align="center" prop="shippingFee"/>
      <!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['ali:trade:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['ali:trade:remove']"
          >删除</el-button>
        </template>
      </el-table-column>-->
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改交易记录对话框 -->
    <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="900px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row :gutter="24" class="mb8">
          <el-col :span="8">
            <el-form-item label="业务类型" prop="businesstype">
              <el-select v-model="form.businesstype" placeholder="请选择业务类型">
                <el-option label="请选择字典生成" value=""/>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="交付时间" prop="alldeliveredtime">
              <el-date-picker clearable
                              v-model="form.alldeliveredtime"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择交付时间"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="修改时间" prop="modifytime">
              <el-date-picker clearable
                              v-model="form.modifytime"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择修改时间"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>


        <el-row :gutter="24" class="mb8">
          <el-col :span="8">
            <el-form-item label="交易状态" prop="status">
              <el-select v-model="form.status" placeholder="请选择交易状态">
                <el-option label="请选择字典生成" value=""/>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="交易总金额" prop="totalamount">
              <el-input v-model="form.totalamount" placeholder="请输入交易总金额"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="交易类型" prop="tradetype">
              <el-select v-model="form.tradetype" placeholder="请选择交易类型">
                <el-option label="请选择字典生成" value=""/>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24" class="mb8">
          <el-col :span="8">
            <el-form-item label="消费品支付" prop="sumproductpayment">
              <el-input v-model="form.sumproductpayment" placeholder="请输入消费品支付"/>
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-form-item label="收货地址" prop="address">
              <el-input v-model="form.address" type="textarea" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24" class="mb8">
          <el-col :span="8">
            <el-form-item label="手机号" prop="mobile">
              <el-input v-model="form.mobile" placeholder="请输入手机号"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="渠道类型" prop="channelType">
              <el-select v-model="form.channelType" placeholder="请选择渠道类型">
                <el-option label="请选择字典生成" value=""/>
              </el-select>
            </el-form-item>

          </el-col>
          <el-col :span="8">
            <el-form-item label="店名" prop="storeName">
              <el-input v-model="form.storeName" placeholder="请输入店名"/>
            </el-form-item>


          </el-col>
        </el-row>
        <el-row :gutter="24" class="mb8">
          <el-col :span="8">
            <el-form-item label="运费" prop="shippingFee">
              <el-input v-model="form.shippingFee" placeholder="请输入运费"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
          </el-col>
          <el-col :span="8">
          </el-col>
        </el-row>
        <el-row :gutter="24" class="mb8">
          <el-col :span="8">
          </el-col>
          <el-col :span="8">
          </el-col>
          <el-col :span="8">
          </el-col>
        </el-row>

        <el-divider content-position="center">订单明细信息</el-divider>
        <!--          <el-row :gutter="10" class="mb8">
                    <el-col :span="1.5">
                      <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddAlTradeProd">添加</el-button>
                    </el-col>
                    <el-col :span="1.5">
                      <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteAlTradeProd">删除</el-button>
                    </el-col>
                  </el-row>-->
        <el-table :data="alTradeProdList" :row-class-name="rowAlTradeProdIndex"
                  @selection-change="handleAlTradeProdSelectionChange" ref="alTradeProd"
        >
          <el-table-column type="selection" width="50" align="center"/>
          <el-table-column label="序号" align="center" prop="index" width="50"/>
          <el-table-column label="主键ID" prop="uuid" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.uuid" placeholder="请输入主键ID"/>
            </template>
          </el-table-column>
          <el-table-column label="商品ID" prop="productid" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.productid" placeholder="请输入商品ID"/>
            </template>
          </el-table-column>
          <el-table-column label="商品名称" prop="name" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.name" placeholder="请输入商品名称"/>
            </template>
          </el-table-column>
          <el-table-column label="实付金额" prop="itemamount" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.itemamount" placeholder="请输入实付金额"/>
            </template>
          </el-table-column>
          <el-table-column label="原始价格" prop="price" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.price" placeholder="请输入原始价格"/>
            </template>
          </el-table-column>
          <el-table-column label="退款金额" prop="refund" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.refund" placeholder="请输入退款金额"/>
            </template>
          </el-table-column>
          <el-table-column label="商品图片url" prop="productsnapshoturl" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.productsnapshoturl" placeholder="请输入商品图片url"/>
            </template>
          </el-table-column>
          <el-table-column label="数量" prop="quantity" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.quantity" placeholder="请输入数量"/>
            </template>
          </el-table-column>
          <el-table-column label="单位" prop="unit" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.unit" placeholder="请输入单位"/>
            </template>
          </el-table-column>
          <el-table-column label="状态" prop="status" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.status" placeholder="请选择状态">
                <el-option label="请选择字典生成" value=""/>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="子订单状态描述" prop="statusstr" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.statusstr" placeholder="请输入子订单状态描述"/>
            </template>
          </el-table-column>
          <el-table-column label="订单号或商品明细条目ID" prop="subitemid" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.subitemid" placeholder="请输入订单号或商品明细条目ID"/>
            </template>
          </el-table-column>
          <el-table-column label="订单号或商品明细条目" prop="subitemidstring" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.subitemidstring" placeholder="请输入订单号或商品明细条目"/>
            </template>
          </el-table-column>
          <el-table-column label="发货方式" prop="logisticsstatus" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.logisticsstatus" placeholder="请选择发货方式">
                <el-option label="请选择字典生成" value=""/>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="创建时间" prop="gmtcreate" width="240">
            <template slot-scope="scope">
              <el-date-picker clearable v-model="scope.row.gmtcreate" type="date" value-format="yyyy-MM-dd"
                              placeholder="请选择创建时间"
              />
            </template>
          </el-table-column>
          <el-table-column label="修改时间" prop="gmtmodified" width="240">
            <template slot-scope="scope">
              <el-date-picker clearable v-model="scope.row.gmtmodified" type="date" value-format="yyyy-MM-dd"
                              placeholder="请选择修改时间"
              />
            </template>
          </el-table-column>
          <el-table-column label="渠道类型" prop="channelType" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.channelType" placeholder="请选择渠道类型">
                <el-option label="请选择字典生成" value=""/>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="店名" prop="storeName" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.storeName" placeholder="请输入店名"/>
            </template>
          </el-table-column>
          <el-table-column label="主交易状态" prop="trastatus" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.trastatus" placeholder="请选择主交易状态">
                <el-option label="请选择字典生成" value=""/>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="skuid" prop="skuid" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.skuid" placeholder="请输入skuid"/>
            </template>
          </el-table-column>
          <el-table-column label="sku编号" prop="skunum" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.skunum" placeholder="请输入sku编号"/>
            </template>
          </el-table-column>
          <el-table-column label="产品编号" prop="pronum" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.pronum" placeholder="请输入产品编号"/>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" :title="downloadTitle" :visible.sync="downloadOpen" width="900px" append-to-body
               v-loading="downloadLoading"
    >
      <el-form
        inline
        size="small"
        :model="downloadForm"
        label-width="7em"
        class="add-form"
      >
        <el-form-item label="开始时间" prop="startDate">
          <el-date-picker
            v-model="downloadForm.startDate"
            type="date"
            placeholder="请选择开始时间"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间" prop="endDate">
          <el-date-picker
            v-model="downloadForm.endDate"
            type="date"
            placeholder="请选择结束时间"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitDownloadForm">确 定</el-button>
        <el-button @click="cancelDownload">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listTrade, getTrade, delTrade, addTrade, updateTrade } from '@/api/ali/trade'
import request from '@/utils/request'

export default {
  name: 'Trade',
  data() {
    return {
      // 遮罩层
      loading: true,
      downloadLoading: false,
      downloadOpen: false,
      downloadTitle: '',
      // 选中数组
      ids: [],
      // 子表选中数据
      checkedAlTradeProd: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 交易记录表格数据
      tradeList: [],
      // 订单明细表格数据
      alTradeProdList: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      // 产品编号时间范围
      daterangeCreatetime: [],
      // 产品编号时间范围
      daterangeAlldeliveredtime: [],
      // 产品编号时间范围
      daterangePaytime: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        businesstype: null,
        createtime: null,
        alldeliveredtime: null,
        modifytime: null,
        paytime: null,
        status: null,
        tradetype: null,
        sumproductpayment: null,
        address: null,
        mobile: null,
        channelType: null,
        storeName: null
      },
      // 表单参数
      form: {},
      downloadForm: {},
      // 表单校验
      rules: {}
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询交易记录列表 */
    getList() {
      this.loading = true
      this.queryParams.params = {}
      if (null != this.daterangeCreatetime && '' != this.daterangeCreatetime) {
        this.queryParams.params['beginCreatetime'] = this.daterangeCreatetime[0]
        this.queryParams.params['endCreatetime'] = this.daterangeCreatetime[1]
      }
      if (null != this.daterangeAlldeliveredtime && '' != this.daterangeAlldeliveredtime) {
        this.queryParams.params['beginAlldeliveredtime'] = this.daterangeAlldeliveredtime[0]
        this.queryParams.params['endAlldeliveredtime'] = this.daterangeAlldeliveredtime[1]
      }
      if (null != this.daterangePaytime && '' != this.daterangePaytime) {
        this.queryParams.params['beginPaytime'] = this.daterangePaytime[0]
        this.queryParams.params['endPaytime'] = this.daterangePaytime[1]
      }
      listTrade(this.queryParams).then(response => {
        this.tradeList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        businesstype: null,
        createtime: null,
        alldeliveredtime: null,
        modifytime: null,
        paytime: null,
        status: null,
        totalamount: null,
        tradetype: null,
        alipaytradeid: null,
        buyerloginid: null,
        sellerloginid: null,
        sumproductpayment: null,
        address: null,
        province: null,
        city: null,
        area: null,
        areacode: null,
        town: null,
        towncode: null,
        telephone: null,
        mobile: null,
        fax: null,
        channelType: null,
        storeName: null,
        customerId: null,
        shippingFee: null
      }
      this.alTradeProdList = []
      this.resetForm('form')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeCreatetime = []
      this.daterangeAlldeliveredtime = []
      this.daterangePaytime = []
      this.resetForm('queryForm')
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = '添加交易记录'
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const id = row.id || this.ids
      getTrade(id).then(response => {
        this.form = response.data
        this.alTradeProdList = response.data.alTradeProdList
        this.open = true
        this.title = '修改交易记录'
      })
    },
    handleDownload() {
      this.downloadOpen = true
      this.downloadTitle = '选择下载时间'
    },
    submitDownloadForm() {
      this.downloadLoading = true
      request({
        url: `/third/aliTrade/download`,
        method: 'post',
        data: {
          startDate: this.downloadForm.startDate + ' 00:00:00',
          endDate: this.downloadForm.endDate + ' 23:59:59'
        }
      }).then((res) => {
        if (res.code === 200) {
          this.downloadLoading = false
        }
        this.downloadOpen = false
        this.$message({
          type: 'success',
          message: '下载成功!'
        })
      })
    },
    cancelDownload() {
      this.downloadOpen = false
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          this.form.alTradeProdList = this.alTradeProdList
          if (this.form.id != null) {
            updateTrade(this.form).then(response => {
              this.$modal.msgSuccess('修改成功')
              this.open = false
              this.getList()
            })
          } else {
            addTrade(this.form).then(response => {
              this.$modal.msgSuccess('新增成功')
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids
      this.$modal.confirm('是否确认删除交易记录编号为"' + ids + '"的数据项？').then(function() {
        return delTrade(ids)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('删除成功')
      }).catch(() => {
      })
    },
    /** 订单明细序号 */
    rowAlTradeProdIndex({ row, rowIndex }) {
      row.index = rowIndex + 1
    },
    /** 订单明细添加按钮操作 */
    handleAddAlTradeProd() {
      let obj = {}
      obj.uuid = ''
      obj.productid = ''
      obj.name = ''
      obj.itemamount = ''
      obj.price = ''
      obj.refund = ''
      obj.productsnapshoturl = ''
      obj.quantity = ''
      obj.unit = ''
      obj.status = ''
      obj.statusstr = ''
      obj.subitemid = ''
      obj.subitemidstring = ''
      obj.logisticsstatus = ''
      obj.gmtcreate = ''
      obj.gmtmodified = ''
      obj.channelType = ''
      obj.storeName = ''
      obj.trastatus = ''
      obj.skuid = ''
      obj.skunum = ''
      obj.pronum = ''
      this.alTradeProdList.push(obj)
    },
    /** 订单明细删除按钮操作 */
    handleDeleteAlTradeProd() {
      if (this.checkedAlTradeProd.length == 0) {
        this.$modal.msgError('请先选择要删除的订单明细数据')
      } else {
        const alTradeProdList = this.alTradeProdList
        const checkedAlTradeProd = this.checkedAlTradeProd
        this.alTradeProdList = alTradeProdList.filter(function(item) {
          return checkedAlTradeProd.indexOf(item.index) == -1
        })
      }
    },
    /** 复选框选中数据 */
    handleAlTradeProdSelectionChange(selection) {
      this.checkedAlTradeProd = selection.map(item => item.index)
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('ali/trade/export', {
        ...this.queryParams
      }, `trade_${new Date().getTime()}.xlsx`)
    }
  }
}
</script>
